# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cudahashcat
pkgver=2.01
pkgrel=2
pkgdesc='Worlds fastest WPA cracker with dictionary mutation engine.'
url='http://hashcat.net/oclhashcat/'
arch=('x86_64')
license=('custom')
groups=('blackarch-cracker')
optdepends=('nvidia-utils>=319.37: For gpu support via Nvidia CUDA')
#source=("https://dl.packetstormsecurity.net/Crackers/cudaHashcat-$pkgver.7z")
source=("http://hashcat.net/files/cudaHashcat-$pkgver.7z")
sha512sums=('027dbe92a085bc4b115cc8c3705510084dab556292df9f12168cd3f6796a730a77573056a95607a58d8f6527bb91a277861b07b49a941dcc2883e2c94cfb7edf')
options=('!strip')

package() {
  cd "cudaHashcat-$pkgver"

  find . \( -name "*.cmd" -o -name "*.exe" \) -exec rm {} +

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" docs/*

  rm -rf docs

  cp -a * "$pkgdir/usr/share/$pkgname"

  if [[ "$CARCH" == 'x86_64' ]];
  then
    cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/bash
/usr/share/$pkgname/cudaHashcat64.bin "\$@"
EOF
  else
    cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/bash
/usr/share/$pkgname/cudaHashcat32.bin "\$@"
EOF
  fi
  chmod +x "$pkgdir/usr/bin/$pkgname"
}

